/**
 * @Description： 学期Service接口实现
 * @author： 20155872 游宇
 * @createTime: 2018-05-17 10:26
 **/



/**
 * @Description
 * @author 20155870 杨润增
 * @create 2018-05-18 16:09
 **/
package com.academic_system.service.impl;

import com.academic_system.model.Term;
import com.academic_system.mapper.TermDao;
import com.academic_system.service.TermService;
import com.academic_system.util.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * @className: TermImpl
 * @Description: 学期Service接口实现
 * @createTime: 2018-05-17 10:26
**/

@Service
public class TermImpl implements TermService {
    @Autowired
    private TermDao termDao;


    @Override
    public Msg getAllTerm() {
        List<Term> list=termDao.getAllTerm();
        if (list.size()!=0){
            return Msg.addData(1,"获取全部的学期学年成功!",list);
        }
        return Msg.fail();
    }

    @Override
    public Msg addTerm(Term term) {
        if (termDao.addTerm(term)) {
            return Msg.addData(1, "添加学期学年成功!");
        }
        return Msg.fail();
    }



    @Override
    public Msg queryTermId(String termYear, String termNum) {
        if (termYear!=null&&termNum!=null){
            Term term=termDao.queryTermId(termYear,termNum);
            return Msg.addData(100,"成功",term);

        }
        return Msg.fail();
    }
}
